﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using PloobsEngine.Entity;
using PloobsEngine.MessageSystem;
using PloobsEngine.SceneControl;
using Microsoft.Xna.Framework.Graphics;

namespace PloobsEngine.Light
{
    public abstract class DeferredLight : ILight, IEntity,IRecieveMessageEntity
    {
        #region ILight Members


        public abstract LightType LightType
        {
            get;
        }


        #endregion

        public abstract void Serialize(System.Xml.XmlTextWriter textWriter);   
        public abstract void DeSerialize(System.Xml.XmlNode node,EngineStuff engine,IWorld world);


        private string _name = null;        
        private int id;
        protected Matrix viewMatrix;
        protected Matrix projMatrix;
        protected float _bias;

        
        public float SHADOWBIAS
        {
            get { return _bias; }
            set { _bias = value; }
        }

        protected Color color;

        public Color Color
        {
            get
            {
                return color;
            }
            set
            {
                this.color = value;
            }
        }


        
        public virtual Matrix ViewMatrix
        {
            set
            {
                this.viewMatrix = value;
            }
            get
            {
                return this.viewMatrix;
            }
        }

        public virtual Matrix ProjMatrix
        {
            set
            {
                this.projMatrix = value;
            }
            get
            {
                return this.projMatrix;
            }
        }



        #region IEntity Members

        public int getId()
        {
            return id;
        }

        public void setId(int id)
        {
            this.id = id;
        }


        #endregion


        #region ILight Members


        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                this._name = value;
            }
        }

        #endregion

        #region ILight Members

        private bool castShadow = false;
        public bool CastShadown
        {
            get
            {
                return castShadow;
            }
            set
            {
                this.castShadow = value;
            }
        }

        #endregion

        #region IRecieveMessageEntity Members

        public virtual bool HandleThisMessageType(SenderType type)
        {
            return false;
        }

        public virtual void HandleMessage(Message mes)
        {            
        }

        #endregion
    }
}
